# Uninstall hook code here
require 'ftools'
require 'fileutils'

plugins_dir = File.expand_path(".")
saucy_dir = File.join(plugins_dir, 'saucy')
root_dir = File.join(saucy_dir, '..', '..', '..')

puts "\n\nUninstalling Saucy Plugin for Rails\n"

puts "Removing javascripts"
FileUtils.rm_r File.join(root_dir, 'public', 'javascripts', 'saucy' ) rescue "... failed"
puts "Removing saucy_test_pages"
FileUtils.rm_r File.join(root_dir, 'public', 'saucy_test_pages') rescue puts "... failed"
puts "Removing saucy.rb"
FileUtils.rm File.join(root_dir, 'lib',  'saucy.rb') rescue puts "... failed "
puts "Removing saucy_controller.rb"
FileUtils.rm File.join(root_dir, 'app', 'controllers', 'saucy_controller.rb') rescue puts "... failed "
puts "Removing images/saucy"
FileUtils.rm_r File.join(root_dir, 'public', 'images', 'saucy') rescue puts "... failed "
puts "Uninstallation complete. \n\n"
